﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model.Sadharon;
using Model.Poribar;
using Model.Sohaok;
using Model.Poribar.ProductPanjeri;
using Model.Poribar.ColourPanjeri;
using Model.Poribar.SizePanjeri;
using Model.Panjeri;
using Model.Upadan;
namespace InventorySys.controller
{
    public class ColorController
    {
        private ProductColor color;
        private ColourKaz colourRow;
        public ColorController() {
            colourRow = Panjeri.getColourPanjeri();
        }

        public Result addNewColor(Object colorObj) {

            return colourRow.create((ProductColor)colorObj);

        }

        public Result GetAllProductColor() {
            return colourRow.All();
        }
        public Result UpdateProductColor(string colorValue, string name) {

            color = (ProductColor)colourRow.getByName(name).ResultObj;
            color.Name = colorValue;
            return colourRow.update(color);
        }

        public Result DeleteProductColor(string name) {
            color = (ProductColor)colourRow.getByName(name).ResultObj;
            return colourRow.delete(color.Id);
        }
    }
}
